<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function * gen(){
            //yield 是可以认为是代码分隔符
            yield '今天赚了100'
            yield '昨天赚了200'
            yield '明天还要赚钱'
        }
        const iterator = gen()
        // console.log(iterator.next())
        // console.log(iterator.next())
        // console.log(iterator.next())
        // console.log(iterator.next())
        for(let c of iterator){
            console.log(c)
        }
    </script>
</body>
</html>